]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
layout: Move the keybinding mode to the user of PressureBarrier
authorJasper St. Pierre <jstpierre@mecheye.net>
Fri, 1 Mar 2013 20:45:56 +0000 (15:45 -0500)
committerJasper St. Pierre <jstpierre@mecheye.net>
Mon, 4 Mar 2013 20:50:44 +0000 (15:50 -0500)
For the hot corner case, we want to have the pressure apply both in
and outside of the overview, so we need to move this to the user. At
the same time, use keybinding mode math that's more like what's used
in filterKeybinding.

While it may seem like an abuse of the KeyBindingMode API, it may
become more reasonable if one thinks of the pressure barrier as a
binding of sorts, just applied to the mouse. If a ButtonBinding API
was added to mutter, I think we'd use the existing KeyBindingMode
infastructure there as well.

js/ui/layout.js

index e2691c0f42bea8b9bb7e3fc4a1c297c1a19119cb..29703c8b02b084277b8fc936368ba91b97d6c00f 100644 (file)
@@ -441,7 +441,11 @@ const LayoutManager = new Lang.Class({
                                                y1: monitor.y + monitor.height, y2: monitor.y + monitor.height,
                                                directions: Meta.BarrierDirection.NEGATIVE_Y });
 
-        this._trayPressure = new PressureBarrier(this._trayBarrier, MESSAGE_TRAY_PRESSURE_THRESHOLD, MESSAGE_TRAY_PRESSURE_TIMEOUT);
+        this._trayPressure = new PressureBarrier(this._trayBarrier,
+                                                 MESSAGE_TRAY_PRESSURE_THRESHOLD,
+                                                 MESSAGE_TRAY_PRESSURE_TIMEOUT,
+                                                 Shell.KeyBindingMode.NORMAL |
+                                                 Shell.KeyBindingMode.OVERVIEW);
         this._trayPressure.connect('trigger', function(barrier) {
             Main.messageTray.openTray();
         });
@@ -1258,10 +1262,11 @@ const HotCorner = new Lang.Class({
 const PressureBarrier = new Lang.Class({
     Name: 'PressureBarrier',
 
-    _init: function(barrier, threshold, timeout) {
+    _init: function(barrier, threshold, timeout, keybindingMode) {
         this._barrier = barrier;
         this._threshold = threshold;
         this._timeout = timeout;
+        this._keybindingMode = keybindingMode;
         this._orientation = (barrier.y1 == barrier.y2) ? Clutter.Orientation.HORIZONTAL : Clutter.Orientation.VERTICAL;
 
         this._isTriggered = false;
@@ -1344,11 +1349,8 @@ const PressureBarrier = new Lang.Class({
         if (event.grabbed && Main.modalCount == 0)
             return;
 
-        let isOverview = ((Main.keybindingMode & (Shell.KeyBindingMode.OVERVIEW)) != 0);
-
-        // Throw out events where the grab is taken by something that's
-        // not the overview (modal dialogs, etc.)
-        if (event.grabbed && !isOverview)
+        // Throw out all events not in the proper keybinding mode
+        if (!(this._keybindingMode & Main.keybindingMode))
             return;
 
         let slide = this._getDistanceAlongBarrier(event);